import React,{FC} from "react";
import { Typography } from "antd";
import { QuestionParagraphPropsType,QuestionParagraphDefaultProps } from "./interface";
const {Paragraph}=Typography
const Component:FC<QuestionParagraphPropsType>=(props:QuestionParagraphPropsType)=>{
    const {text='',isCenter=false}={...QuestionParagraphDefaultProps,...props}
    const textList=text.split('\n')
    return <Paragraph style={{textAlign:isCenter?'center':'start',marginBottom:'20px'}} >
        {/* 输入回车换行显示 谨慎使用 dangerouslySetInnerHTML*/}
        {textList.map((t,index)=>(<span key={index}>{index>0&&<br/>}{t}</span>))}
    </Paragraph>
}
export default Component